package com.anne.fish.model;

import com.anne.fish.model.BaseObject;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import javax.xml.bind.annotation.XmlRootElement;

import java.io.Serializable;

@Entity
@Table(name="member_company",catalog="fish")
@Searchable
@XmlRootElement
public class MemberCompany extends BaseObject implements Serializable {
    private Long id;
    private String title;
    private String content;
    private boolean showOn;
    private Long memberId;
    private Long createTime;
    private Long updateTime;

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="title", nullable=false)
    @SearchableProperty
    public String getTitle() {
        return this.title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    @Column(name="content", nullable=false)
    @SearchableProperty
    public String getContent() {
        return this.content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    @Column(name="show_on", nullable=false)
    @SearchableProperty
    public boolean isShowOn() {
        return this.showOn;
    }
    
    public void setShowOn(boolean showOn) {
        this.showOn = showOn;
    }
    
    @Column(name="member_id", nullable=false)
    @SearchableProperty
    public Long getMemberId() {
        return this.memberId;
    }
    
    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }
    
    @Column(name="create_time", nullable=false)
    @SearchableProperty
    public Long getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    
    @Column(name="update_time", nullable=false)
    @SearchableProperty
    public Long getUpdateTime() {
        return this.updateTime;
    }
    
    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MemberCompany pojo = (MemberCompany) o;

        if (title != null ? !title.equals(pojo.title) : pojo.title != null) return false;
        if (content != null ? !content.equals(pojo.content) : pojo.content != null) return false;
        if (showOn != pojo.showOn) return false;
        if (memberId != null ? !memberId.equals(pojo.memberId) : pojo.memberId != null) return false;
        if (createTime != null ? !createTime.equals(pojo.createTime) : pojo.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(pojo.updateTime) : pojo.updateTime != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (title != null ? title.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (showOn ? 1 : 0);
        result = 31 * result + (memberId != null ? memberId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("title").append("='").append(getTitle()).append("', ");
        sb.append("content").append("='").append(getContent()).append("', ");
        sb.append("showOn").append("='").append(isShowOn()).append("', ");
        sb.append("memberId").append("='").append(getMemberId()).append("', ");
        sb.append("createTime").append("='").append(getCreateTime()).append("', ");
        sb.append("updateTime").append("='").append(getUpdateTime()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
